package com.ServiceTest;


import com.Service.UserService;
import com.javabean.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;




public class test {
    @Test
    public void test(){
        ApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = (UserService) applicationContext.getBean("userService");
        userService.save();
    }

    @Test
    public void t2(){
        ApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean(User.class);
        System.out.println(user);
    }

    @Test
    public void t3(){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u1");
        System.out.println(user);
        applicationContext.close();
    }
    @Test
    public void t4(){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u2");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t5(){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u3");
        System.out.println(user);
    }

    @Test
    public void t6(){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u4");
        System.out.println(user);
    }

    @Test
    public void t7(){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u5");
        System.out.println(user);
    }

    @Test
    public void t8(){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u6");
        System.out.println(user);
    }

    @Test
    public void t9 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u7");
        System.out.println(user);
    }

    @Test
    public void t10 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u8");
        System.out.println(user);
    }
}
